package com.cn.yl.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cn.yl.dao.SecUserMapper;
import com.cn.yl.model.SecUser;
import com.cn.yl.model.SecUserExample;
import com.cn.yl.service.IUserService;
@Service
public class UserServiceImpl implements IUserService{
	
	@Autowired
	private SecUserMapper userTMapper;
	
	public SecUser getUserById(int userId) {
		// TODO Auto-generated method stub
		return userTMapper.selectByPrimaryKey(userId);
	}
	


	@Override
	public SecUser getByUsername(String userName) {
		// TODO Auto-generated method stub
		SecUserExample example=new SecUserExample();
		example.createCriteria().andUserNameEqualTo(userName);
		List<SecUser> list=userTMapper.selectByExample(example);
		if(list.isEmpty()){
			return null;
		}
		return list.get(0);
	}
}
